package com.platform.destiny.exception;

import lombok.Data;
import org.springframework.http.HttpStatus;

import java.io.Serializable;

/**
 * @Description
 * @Author kaiyang
 * @Date 2024-01-30 4:32 PM
 */

@Data
public final class AppException extends RuntimeException implements Serializable {


    private String msg;
    private Integer code;

    public AppException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public AppException(RetCode code) {
        super(code.msg);
        this.code = code.code;
        this.msg = code.msg;
    }

    public AppException(String msg) {
        super(msg);
        this.code = HttpStatus.UNAUTHORIZED.value();
        this.msg = msg;
    }


}
